

//    var w=window.open("","_top");
//    w.opener=window;
//    w.onbeforeunload = closeChildWindow;



function centerizeWindow(myWidth,myHeight){
    var iWidth=screen.availWidth;
    var iHeight=screen.availHeight;
    var iXPos=0;
    var iYPos=0;
    if (iWidth>myWidth)
    {
        iXPos=(iWidth-myWidth)/2;
        iWidth=myWidth;
    }
    if ( iHeight>myHeight)
    {
        iYPos=(iHeight-myHeight)/2;
        iHeight=myHeight;
    }

    if(window!=null) window.moveTo(iXPos, iYPos);
    if(window!=null) window.resizeTo(iWidth, iHeight);
}


function centerizeWindow2(windowName,myWidth,myHeight){
    var iWidth=screen.availWidth;
    var iHeight=screen.availHeight;
    var iXPos=0;
    var iYPos=0;
    // Window size initialize.
    // Move to center.
    if (iWidth>myWidth)
    {
        iXPos=(iWidth-myWidth)/2;
        iWidth=myWidth;
    }
    if ( iHeight>myHeight)
    {
        iYPos=(iHeight-myHeight)/2;
        iHeight=myHeight;
    }

    if(windowName!=null) {
        try{
            windowName.moveTo(iXPos, iYPos);
        }catch(myErr){
        }
    }
    if(windowName!=null) {
        try{
            windowName.resizeTo(iWidth, iHeight);
        }catch(myErr){
        }
    }
}


function createLoadingPic(path,pageWidth,pageHeight){
    var width=pageWidth - 50;
    var height=pageHeight - 50;
    var centerwidth=width/2;
    var centerheight=height/2;

    document.write("<div id=\"image_canvas\" style=\"position:absolute;left:0px;top:0px;\">");
    document.write("<img src=\""+path+"/images/canvas.gif\"   width=\""+width+"\" height=\""+height+"\" />");
    document.write("<\/div>");
    document.write("<div id=\"image_loader\" style=\"position:absolute;left:"+centerwidth+"px;top:"+centerheight+"px;\">");
    document.write("<img src=\""+path+"/images/loading.gif\" />");
    document.write("<\/div>");

}

function hideLoadingPic(){
    var div_canvas = document.getElementById("image_canvas");
    if(div_canvas==null) return;
    div_canvas.style.display = "none";
    var div_loader = document.getElementById("image_loader");
    div_loader.style.display = "none";
    var div_screen=document.getElementById("screen");
    div_screen.style.cursor="auto";
}